import request from "@/util/request";

const goodsBase = '/goods/'

export function save(data) {
    return request({
        method: 'post',
        url: goodsBase + 'save',
        data
    })
}

export function getSpuList(pageNum, pageSize, spuSearchDto) {
    return request({
        method: 'get',
        url: goodsBase + `get/spu/list/${pageNum}/${pageSize}`,
        params: spuSearchDto
    })
}

export function getSpuAtlas(spuId) {
    return request({
        method: 'get',
        url: goodsBase + `get/spuAtlas/list/${spuId}`,
    })
}

/**
 * 获取sku的图集
 * @param skuId
 * @returns {*}
 */
export function getSkuAtlas(skuId) {
    return request({
        method: 'get',
        url: `sku/atlas`,
        params: {skuId}
    })
}

export function getSkuList(skuSearchDto) {
    return request({
        method: 'get',
        url: goodsBase + `get/sku/page`,
        params: skuSearchDto
    })
}

export function modifySku(data) {
    return request({
        method: 'put',
        url: goodsBase + `modify/sku`,
        data
    })
}

export function goodsUp(spuId) {
    return request({
        method: 'post',
        url: goodsBase + `up`,
        params: {
            spuId
        }

    })
}

